package oop.java0317;

/**
 * 电脑有品牌，价格，颜色，屏幕大小等属性，定义并测试电脑对象，并输出
 */
public class Test4 {
    public static void main(String[] args) {
        Computer c1 = new Computer();
        c1.init("小米", 4999, "银色", 13.3);
        c1.print();
    }
}

//电脑类
class Computer {
    //品牌
    String brand;
    //价格
    double price;
    //颜色
    String color;
    //屏幕吃寸
    double screen;

    //初始化
    public void init(String brand, double price, String color, double screen) {
        this.brand = brand;
        this.color = color;
        this.price = price;
        this.screen = screen;
    }

    //输出信息
    public void print() {
        System.out.println("品牌：" + brand + "\n价格：" + price + "元\n颜色：" + color + "\n屏幕大小" + screen + "英寸");
    }
}
